<?php
/**
 * CakeCMS - 后台首页
 * 功能模块:
 *
 * @author zzdboy
 * @version 1.0
 */
class IndexController extends AppController {
	public $components = array (
			'CheckUserPermission' 
	);
	
	/**
	 * 初始化执行
	 *
	 * @see AppController::beforeFilter()
	 */
	public function beforeFilter() {
		parent::beforeFilter ();
		
		// 判断是否登录
		$this->CheckUserPermission->checkLogin ( $this );
		
		$this->set ( 'title_for_layout', 'CakeCMS后台管理系统' );
	}
	public function index() {
		if ($this->Session->read ( 'admin_uid' )) {
			// 加载Admin model
			$this->loadModel ( 'Admin' );
			$AdminInfo = $this->Admin->GetAdminByID ( $this->Session->read ( 'admin_uid' ) );
			$this->set ( 'AdminInfo', $AdminInfo ['Admin'] );
			
			// 加载Admin model
			$this->loadModel ( 'Menu' );
			
			// 顶部导航菜单
			$admin_menu = $this->Menu->admin_menu ( 0 );
			$this->set ( 'admin_menu', $admin_menu );
		}
		
		$this->set ( 'title_for_layout', 'CakeCMS后台管理系统' );
	}
}
?>